package net.lee.shiro.demo.entity.usersystem;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "role_menu", schema = "admin_system", catalog = "")
@IdClass(RoleMenuEntityPK.class)
public class RoleMenuEntity {
    private long roleId;
    private long menuId;
    private Timestamp addTime;

    @Id
    @Column(name = "role_id")
    public long getRoleId() {
        return roleId;
    }

    public void setRoleId(long roleId) {
        this.roleId = roleId;
    }

    @Id
    @Column(name = "menu_id")
    public long getMenuId() {
        return menuId;
    }

    public void setMenuId(long menuId) {
        this.menuId = menuId;
    }

    @Basic
    @Column(name = "add_time")
    public Timestamp getAddTime() {
        return addTime;
    }

    public void setAddTime(Timestamp addTime) {
        this.addTime = addTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RoleMenuEntity that = (RoleMenuEntity) o;
        return roleId == that.roleId &&
                menuId == that.menuId &&
                Objects.equals(addTime, that.addTime);
    }

    @Override
    public int hashCode() {

        return Objects.hash(roleId, menuId, addTime);
    }
}
